package edu.gdpu.classloader;

import java.util.UUID;

/**
 * @author mazebin
 * @date 2021年 07月06日 16:19:18
 * <p>
 *    准备和初始化阶段的赋值问题
 *
 * </p>
 */

public class ClassLoaderTest6 {
    public static void main(String[] args) throws Exception {
        Singleton instance = Singleton.getInstance();
        System.out.println("main a:"+instance.getA());//1
        System.out.println("main b:"+instance.getB());//49

    }
}
class Singleton{
    private static int a;
    private static  Singleton instance = new Singleton();
    public Singleton(){
        a++;
        b++;
        System.out.println("a:"+a);//1
        System.out.println("b:"+b);//1
    }
    public static int b=49;

    public static Singleton getInstance() {
        return instance;
    }

    public static int getA() {
        return a;
    }

    public static int getB() {
        return b;
    }
}

